package pl.perseus.service.degree;

import java.util.List;

import lombok.Data;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import pl.perseus.dao.IDegreeDao;
import pl.perseus.model.Classes;
import pl.perseus.model.Degree;
import pl.perseus.model.Student;

@Data
@Service
@Transactional
public class DegreeService implements IDegreeService{

	@Autowired
	private IDegreeDao degreeDao;
	
	@Override
	public Degree insertDegree(Degree d) {
		return	degreeDao.insertDegree(d);
	}
	
	@Override
	public Degree selectByIdDegree(Long id){
		return degreeDao.selectByIdDegree(id);
	}

	@Override
	public List<Degree> getDegreesForStudentAndClasses(Student s, Classes c){
		return degreeDao.getDegresForStudentAndClasses(s, c);
	}
	
	@Override
	public Double getAVGForStudentInClasses(Student student, Classes classes){
		return degreeDao.getAVGForStudentInClasses(student, classes);
	}
	
	@Override
	public Degree updateDegree(Degree degree){
		return degreeDao.updateDegree(degree);
	}
	
}
